package com.bjsxt.tank;

import java.awt.Graphics;
import java.awt.Rectangle;

public abstract class GameObject {
    protected int x;
    protected int y;
    protected boolean live = true;
    protected TankClient tc;

    public GameObject(int x, int y, TankClient tc) {
        this.x = x;
        this.y = y;
        this.tc = tc;
    }

    public abstract void draw(Graphics g);
    public abstract Rectangle getRect();

    public boolean isCollideWith(GameObject other) {
        if (!this.live || !other.live) return false;
        return this.getRect().intersects(other.getRect());
    }

    public int getX() { return x; }
    public int getY() { return y; }

    public boolean isLive() { return live; }
    public void setLive(boolean live) { this.live = live; }

    public void move() {}
}
